package com.bao;

public class Test07 {
    private static final int MAX_BOUNCES = 10; // 最大反弹次数
    private static final double BOUNCE_FACTOR = 0.5; // 回弹系数

    public static void main(String[] args) {
        double initialHeight = 100; // 初始高度
        double totalDistance = 0; // 总距离
        int bounceCount = 0; // 反弹次数

        while (bounceCount < MAX_BOUNCES) {
            bounceCount++;
            System.out.println("第" + bounceCount + "次落地");
            totalDistance += initialHeight;
            System.out.println("落地时经过" + totalDistance + "米");
            initialHeight *= BOUNCE_FACTOR; // 回弹
            totalDistance += initialHeight; // 反弹后经过的距离
            System.out.println("第" + bounceCount + "次反弹高度" + initialHeight + "米");
        }
    }
}
